Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

decompress

Package Overview
Dependencies
Maintainers
1
Versions
41
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

decompress

Easily extract archives

  • 0.3.3
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
1.2M
decreased by-57.8%
Maintainers
1
Weekly downloads
 
Created

What is decompress?

The decompress npm package is a module that allows for decompressing archive files such as zip, tar, tar.gz, and many others. It provides a simple API to easily extract files from these archives.

What are decompress's main functionalities?

Extracting archive files

This feature allows you to extract files from an archive like a zip file into a specified directory. The 'decompress' function returns a promise that resolves with an array of file objects when the extraction is complete.

const decompress = require('decompress');

decompress('unicorn.zip', 'dist').then(files => {
    console.log('Files decompressed successfully');
});

Extracting specific files

This feature allows you to extract only specific files from an archive by using a filter function. The filter function is passed each file object, and you return a boolean to indicate whether the file should be extracted.

const decompress = require('decompress');

const filesToExtract = ['unicorn.png', 'rainbow.jpg'];

decompress('archive.zip', 'dist', {
    filter: file => filesToExtract.includes(file.path)
}).then(files => {
    console.log('Selected files decompressed successfully');
});

Using plugins to handle different archive types

The decompress package can be extended with plugins to support more archive types. In this example, the 'decompress-targz' plugin is used to decompress a '.tar.gz' file.

const decompress = require('decompress');
const decompressTargz = require('decompress-targz');

decompress('unicorn.tar.gz', 'dist', {
    plugins: [
        decompressTargz()
    ]
}).then(files => {
    console.log('tar.gz file decompressed successfully');
});

Other packages similar to decompress

Keywords

FAQs

Package last updated on 14 Aug 2014

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc